<%-------------------------------------------------------------------
 * 页面名称：telBankInpour_1.jsp
 * 功能描述：电话银行充值－选择银行
 * Action  : telBankInpour
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
%>
<script type='text/javascript' src='<%=path%>/js/ufront.js'></script>
<script type='text/javascript'
	src='<%=path%>/dwr/interface/accountTemplate.js'></script>
<script type='text/javascript'
	src='<%=path%>/js/vnv/commonForCnAmount.js'></script>
<script type='text/javascript' src='<%=path%>/js/vnv/tomoney.js'></script>
<script language="JavaScript" type="text/JavaScript">
function getRadioValue(radioObject){
	if(radioObject.length==undefined){
		if(radioObject.checked) return radioObject.value;
	}else{
		for(var i=0;i<radioObject.length;i++){
			if(radioObject[i].checked) return radioObject[i].value;
		}
	}
	return undefined;
}
function prepareParameters(){
	var bankId = getRadioValue(document.getElementsByName("bank"));
	
	if(bankId == undefined){
		return false;
	}
	document.forms[0].bankId.value = bankId;
	return true;
}
function validateOrderTel(telephone){
	var regv = /^(((13|15)(\d{9}))|(010[0-9]{8})|(0[2-9][0-9]{9,10}))$/;
	return regv.test(telephone);
}
function submitProcess() {
	var formObj = document.forms["0"];
	if(checkNecessaryInput(formObj)){
		if(!prepareParameters()){
			alert("请选择电话银行！");
			return;
		}
		if(!validateOrderTel(formObj.orderTelephone.value)){
			alert("预留电话号码格式错误，请重新输入！");
			formObj.orderTelephone.value = "";
			formObj.orderTelephone.focus();
			return;
		}
		//alert(document.forms[0].bankId.value);
		formObj.submit();
	}
}
var bankInfoPicUrl = "<%=path%>/images/bank/";
function showBankInfo(radioObj,bankcode) {
	if (radioObj.checked) {
		document.getElementById("bankInfoPic").src = bankInfoPicUrl+bankcode+".gif";
		document.getElementById("bankInfo").style.display = "";
	}
}
function kd(){
	var ss=getObj("amount").value;
	ss = ss.replace(/ /g,"");
	if (ss=="") {
		getObj("upperAmount").value="";
		return;
	}
	
	var sDispMsg = getChineseCurrencyString(ss);
	if(sDispMsg==-1) sDispMsg="错误的金额!";
	if(sDispMsg==-2) sDispMsg="太长的金额!";
	getObj("upperAmount").value=sDispMsg;
}
function updatePrompt(data) {
}

	function amountBlur(objAmount) {
		// 金额失去焦点方法
		if(checkDecimalInput(objAmount,0)) {
			accountTemplate.ifAccountIsEffect(objAmount.value, updatePrompt);
		}
		tomoney('TelBankInpourForm','amount','hideTransAmt');
		kd();
	}

	function selectBank(bankCode) {
		// 点击银行图片选择银行方法
		document.getElementById("check_" + bankCode).checked = true;
		showBankInfo(document.getElementById("check_" + bankCode),bankCode);
	}
</script>
<div id="mainFrame">
	<div class="rightSider2">
		<div class="sub_title">
			<span class="bluefont18bdrop">电话银行充值</span>
		</div>
		<div class="edit_pass">
			<html:form method="post" action="telBankInpour">
				<html:hidden property="bankId" />
				<html:hidden property="step" />
				<html:hidden property="actionType" />
				<table width="100%" border="0" align="center" cellpadding="5"
					cellspacing="1">
					<tr>
						<td width="23%" align="right">
							充值子账户：
						</td>
						<td width="77%">
							<html:select property="subAccountId">
								<html:options collection="subAccounts" property="accountId"
									labelProperty="accountName" />
							</html:select>
						</td>
					</tr>
					<tr>
						<td align="right">
							<span class="orang12b">*</span> 充值金额：
						</td>
						<td>
							<html:text property="amount" alt="充值金额" styleClass="inputStyle"
								onblur="amountBlur(this);" onkeyup="kd();" onchange="kd();" />
							元 &nbsp;&nbsp;
							<img src="<%=path%>/images/money.gif" width="17" height="17"
								style="cursor:hand" title="请使用计算器，计算充值金额"
								onclick="amountSelect();" />
							<input type="hidden" name="hideTransAmt" value="" />
						</td>
					</tr>
					<tr>
						<td align="right">
							充值金额大写：
						</td>
						<td>
							<input name="upperAmount" type="text" class="inputStyleNoborder"
								size="50" style="background:#F6F6F6;" readonly />
						</td>
					</tr>
					<tr>
						<td align="right">
							<span class="orang12b">*</span> 预留电话：
						</td>
						<td>
							<html:text property="orderTelephone" alt="预留电话" maxlength="12"
								size="50" styleClass="inputStyle" />
							<br />
							<span class="font_gray"> 1.固定电话或小灵通为区号加电话号码，如400 600
								7808，不能带分机号。<br /> 2.手机号码11位，不带区号和0。 </span>
						</td>
					</tr>
					<tr>
						<td align="right" valign="top">
							<span class="orang12b">*</span> 请选择要使用的网上银行：
						</td>
						<td>
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<c:forEach var="bank" items="${BankList}" varStatus="status">
									<c:if test="${status.index % 3 == 0}">
										<tr>
									</c:if>
									<td width="5%">
										<label>
											<input type="radio" name="bank" style="border:0"
												value="<c:out value="${bank.id}"/>"
												id="check_<c:out value="${bank.bankCode}"/>"
												onclick="javascript:showBankInfo(this,'<c:out value="${bank.bankCode}"/>');" />
										</label>
									</td>
									<td width="45%">
										<a
											href="javascript:selectBank('<c:out value="${bank.bankCode}"/>')">
											<img alt="<c:out value="${bank.bankName}"/>" border="0"
												src="<%=path%>/images/bank/logo/logo_<c:out value="${bank.bankCode}"/>.gif" />
										</a>
									</td>
									<c:if test="${status.index % 3 == 2}">
										</tr>
									</c:if>
									<c:if test="${status.last && status.count % 3 == 2}">
										<td></td>
										</tr>
									</c:if>
								</c:forEach>
							</table>
						</td>
					</tr>
					<tr id="bankInfo" style="display:none">
						<td align="center" bgcolor="#FFFFFF">
							&nbsp;
						</td>
						<td>
							<img id="bankInfoPic" src="" border="0" />
						</td>
					</tr>
					<tr>
						<td height="55" align="right">
							&nbsp;
						</td>
						<td bgcolor="#FFFFFF">
							<input name="next" type="button" class="button_style"
								onclick="submitProcess();" value="下一步" />
						</td>
					</tr>
				</table>
			</html:form>
			<table width="100%" border="0" align="center" cellpadding="7"
				cellspacing="1" bgcolor="#f9e277" style="margin:10px 0;">
				<tr>
					<td bgcolor="#fffdf5">
						<table width="100%" border="0" cellpadding="3" cellspacing="0">
							<tr>
								<td width="3%" height="25" valign="top"
									style="border-bottom:1px solid #ccc;"></td>
								<td width="97%" align="left" class="red12b"
									style="border-bottom:1px solid #ccc;">
									特别提醒
								</td>
							</tr>
							<tr>
								<td valign="top">
									&nbsp;
								</td>
								<td align="left" class="font_gray">
									您需要先开通电话银行支付服务才可以进行&quot;
									<span class="text9green">电话银行充值</span>&quot;。如果您还没开通，请拨打各银行的电话银行热线，询问申请流程。
								</td>
							</tr>
							<tr>
								<td valign="top">
									&nbsp;
								</td>
								<td align="left" class="font_gray">
									支付账户
									<span class="redColor12px">不允许</span>，进行虚假交易、银行卡转账套现或洗钱等被禁止的交易行为，
									<span class="redColor12px">否则</span>充值款项将不能提现。
									</a>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</div>
	</div>
</div>
<div style="clear:both;"></div>
<script type="text/javascript" src="<%=path%>/js/layer.js"></script>
<script language="JavaScript" type="text/JavaScript">
function closeLayer(returnValue, type){
	hideLayer();
	if(type=="amount"){
		document.forms[0].amount.value=returnValue;
		document.forms[0].amount.focus();
		kd();
	}
}

function amountSelect(){
 	agiledata.getUserInternal(amountPopup);
}
function amountPopup(data) {
  	if(data) {
	 	openLayer("<%=path%>/page/common/simpleCalculator.jsp",400,200,false);
	} else {
		location.href="<%=path%>/page/util/session_invalid.jsp";
	}      
}

//显示预先设置的金额的大写
kd();

//显示预先选择的银行
//alert(document.forms[0].bankId.value);
if (document.forms[0].bank.length==undefined) {
	if (document.forms[0].bank.value==document.forms[0].bankId.value) {
		document.forms[0].bank.click();
	}
} else {
	for (var i=0; i<document.forms[0].bank.length; i++) {
		//alert(document.forms[0].bank[i].value);
		if (document.forms[0].bank[i].value==document.forms[0].bankId.value) {
			document.forms[0].bank[i].click();
			i = document.forms[0].bank.length;
		}
	}
}
</script>
